import Payment from './Payment';
import ApiClient from './ApiClient';

export default {
    pay(order_id) {
        return Payment.requestPay(order_id);
    },
    cancel(order_id) {
        return new Promise((resolve, reject) => {
            ApiClient.post('/user/bought/cancel', { order_id }).then(response => {
                resolve(response);
            }).catch(reason => {
                reject(reason);
            });
        });
    },
    notice(order_id) {
        return new Promise((resolve, reject) => {
            ApiClient.post('/user/bought/notice', { order_id }).then(response => {
                resolve(response);
            }).catch(reason => {
                reject(reason);
            });
        });
    },
    confirm(order_id) {
        return new Promise((resolve, reject) => {
            ApiClient.post('/user/bought/confirm', { order_id }).then(response => {
                resolve(response);
            }).catch(reason => {
                reject(reason);
            });
        });
    }
};
